import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

//vant自动引入所需插件
import Components from 'unplugin-vue-components/vite';
import AutoImport from 'unplugin-auto-import/vite';
import { VantResolver } from 'unplugin-vue-components/resolvers';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    //vant自动按需引用
    AutoImport({
      imports: ['vue', 'vue-router', 'pinia'], 
      resolvers: [VantResolver()],
    }),
    Components({
      dirs: ["src/components", "src/components/**/*"],
      extensions: ['vue'],
      resolvers: [VantResolver()],
    }),
  ],
  resolve: {
    //路径设置
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
})
